<template>
	<view class="content">
		<view class="header-title">
			<image :src="proxy.serverimageUrl + 'topbg.png'" mode=""></image>
			<p class="p1">活动</p>
		</view>
		<view class="pagelist">
			<z-paging :paging-style="{height: '100%'}" default-page-no="1" default-page-size="10" :fixed="false"
				ref="paging" v-model="dataList" @query="queryList">
				<view class="listitem" v-for="(item,index) in dataList" :key="index">
					<view class="image-top">
						<image class="image" :src="item.commonFileRequests[0].url" mode=""></image>
					</view>
					<view class="textBox">
						<p class="title">{{item.activityName}}</p>
						<p class="date"><span class="label" v-if="item.status != 2">进行中</span><span
								v-if="item.status == 2" class="label labels">已结束</span>{{item.activityBeginTime}} -
							{{item.activityEndTime}}</p>
						<view class="imag-avatar">
							<view class="avatar-left">
								<view class="imagebox">
									<image class="image-avatar" v-for="(t,i) in item.avatars" :src="t" :key="i" mode="">
									</image>
								</view>
								<view class="text">
									{{item.enrollment}}人报名
								</view>
							</view>
							<view class="avatar-right" @click="godetail(item)">
								<image :src="proxy.serverimageUrl + 'activty/goimg.png'" mode=""></image>
							</view>
						</view>
					</view>

				</view>
			</z-paging>
		</view>


	</view>
</template>

<script setup>
	import {
		defineProps,
		getCurrentInstance,
		ref
	} from 'vue'
	import {
		articlelist,
		miniList
	} from '../../utils/api.js'
	import {
		onLoad,
		onReady,
		onShow
	} from '@dcloudio/uni-app';
	import useZPaging from "@/uni_modules/z-paging/components/z-paging/js/hooks/useZPaging.js";
	onLoad(() => {})
	const {
		proxy,
		ctx
	} = getCurrentInstance()
	const paging = ref(null)
	const dataList = ref([])

	const queryList = (pageNo, pageSize) => {
		let params = {
			pageNum: pageNo,
			pageSize: pageSize
		}
		miniList(params).then(res => {
			if (res.code == 200) {
				const list = res.rows
				paging.value.complete(list)
			}
		}).catch(res => {
			paging.value.complete(false)
		})
	}
	const godetail = (item) => {
		uni.navigateTo({
			url: '/subpages/activitydetail/index?aid=' + item.aid
		})
	}
</script>

<style scoped lang="scss">
	.content {
		height: 100vh;
		width: 100vw;
		padding: 220rpx 0rpx 0;
		background: #ECEFF9;
		position: relative;

		.header-title {
			position: absolute;
			top: 0;
			width: 100%;
			height: 288rpx;

			image {
				width: 100%;
				height: 288rpx;
			}

			.p1 {
				font-family: Alibaba PuHuiTi;
				font-weight: bold;
				font-size: 36rpx;
				color: #202020;
				position: absolute;
				top: 114rpx;
				left: 40rpx;
			}
		}

		::v-deep .zp-paging-container-content {
			padding: 30rpx;
		}

		.pagelist {
			height: calc(100vh - 222rpx);
		}

		.listitem {
			// width: 670rpx;
			// height: 340rpx;
			margin-top: 30rpx;
			background: rgba(255, 255, 255, .3);
			// border-radius: 20rpx 20rpx 0rpx 0rpx;

			// opacity: 0.3;
			.image-top {
				width: 100%;
				height: 340rpx;
				border-radius: 20rpx 20rpx 0rpx 0rpx;

				.image {
					border-radius: 20rpx 20rpx 0rpx 0rpx;
					width: 100%;
					height: 100%;
				}
			}


			.textBox {
				background-color: #ffffff;
				padding: 30rpx 0 0 30rpx;
				border-radius: 0rpx 0rpx 20rpx 20rpx;

				.title {
					// margin-top: 30rpx;
					font-family: Alibaba PuHuiTi;
					font-weight: 500;
					font-size: 30rpx;
					color: #202020;
				}

				.date {
					font-family: Alibaba PuHuiTi;
					font-weight: 400;
					font-size: 24rpx;
					color: #979BA2;
					margin-top: 19rpx;
					line-height: 28rpx;

					.label {
						width: 80rpx;
						height: 28rpx;
						background: #2854B7;
						border-radius: 4rpx;
						font-family: Alibaba PuHuiTi;
						font-weight: 400;
						font-size: 20rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 28rpx;
						margin-right: 10rpx
					}

					.labels {
						background: #898989;
					}
				}

				.imag-avatar {
					margin-top: 20rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.avatar-left {
						display: flex;
						align-items: center;

						.imagebox {
							display: flex;

							.image-avatar {
								width: 40rpx;
								height: 40rpx;
								border-radius: 50%;
							}

							.image-avatar:nth-child(n+2) {
								margin-left: -10rpx;
							}
						}

						.text {
							margin-left: 12rpx;
							font-family: Alibaba PuHuiTi;
							font-weight: 400;
							font-size: 24rpx;
							color: #979BA2;
						}
					}

					.avatar-right {
						height: 80rpx;

						image {
							width: 80rpx;
							height: 80rpx;
						}
					}
				}
			}

		}


	}
</style>